GetBestControlRect
NEW WITH THE APPEARANCE MANAGER
Determines a control's optimal size and text placement.
pascal OSErr GetBestControlRect ( ControlHandle inControl, Rect *outRect, SInt16 *outBaseLineOffset);
inControl
- On input, a handle to the control whose size you wish to determine.
outRect
- On input, a pointer to the control rectangle you wish to modify; pass an empty rectangle (0, 0, 0, 0). On output, a pointer to the rectangle that the control has determined to be optimal. If the control doesn't support getting an optimal size rectangle, the control's bounding rectangle is passed back.
outBaseLineOffset
- On output, the offset from the bottom of control to the base of the text (usually a negative value). If the control doesn't support optimal sizing or has no text, 0 is passed back.
- function result
- A result code; see "Result Codes".
DISCUSSION
TheGetBestControlRect
function should be called to automatically position and size controls in accordance with human interface guidelines. This function is particularly helpful in determining the correct placement of control text whose length is not known until run-time. For example,StandardAlert
usesGetBestControlRect
to automatically size and position buttons in a newly created alert box.SEE ALSO
"Appearance Manager Gestalt Selector Constants".